﻿using System.Xml.Serialization;
using System.Runtime.Serialization;
using System;

namespace fbasync.Schema
{
    [DataContract, Serializable, XmlRoot("error_response", Namespace = "http://api.facebook.com/1.0/")]
    public class ErrorResponse
    {
        [DataMember(Name = "error_code"), XmlElement("error_code")]
        public int Error_Code { get; set; }

        [DataMember(Name = "error_msg"), XmlElement("error_msg")]
        public string Error_Msg { get; set; }
    }

    namespace Dashboard
    {
        [XmlRoot("dashboard_multiGetCount_response", Namespace = "http://api.facebook.com/1.0/")]
        public class MultiGetCountResponse
        {
            [XmlElement("dashboard_multiGetCount_response_elt")]
            public KeyValuePair<long, int>[] Elements;
        }

        [XmlRoot("dashboard_multiSetCount_response", Namespace = "http://api.facebook.com/1.0/")]
        public class MultiSetCountResponse
        {
            [XmlElement("dashboard_multiSetCount_response_elt")]
            public KeyValuePair<long, bool>[] Elements;
        }

        [XmlRoot("dashboard_multiIncrementCount_response", Namespace = "http://api.facebook.com/1.0/")]
        public class MultiIncrementCountResponse
        {
            [XmlElement("dashboard_multiIncrementCount_response_elt")]
            public KeyValuePair<long, bool>[] Elements;
        }

        [XmlRoot("dashboard_multiDecrementCount_response", Namespace = "http://api.facebook.com/1.0/")]
        public class MultiDecrementCountResponse
        {
            [XmlElement("dashboard_multiDecrementCount_response_elt")]
            public KeyValuePair<long, bool>[] Elements;
        }

        [XmlRoot("dashboard_clearNews_response", Namespace = "http://api.facebook.com/1.0/")]
        public class ClearNewsResponse
        {
            [XmlElement("dashboard_clearNews_response_elt")]
            public KeyValuePair<long, bool>[] Elements;
        }

        [XmlRoot("dashboard_clearGlobalNews_response", Namespace = "http://api.facebook.com/1.0/")]
        public class ClearGlobalNewsResponse
        {
            [XmlElement("dashboard_clearGlobalNews_response_elt")]
            public KeyValuePair<long, bool>[] Elements;
        }

        [XmlRoot("dashboard_multiAddNews_response", Namespace = "http://api.facebook.com/1.0/")]
        public class MultiAddNewsResponse
        {
            [XmlElement("dashboard_multiAddNews_response_elt")]
            public KeyValuePair<long, long>[] Elements;
        }

        [XmlRoot("dashboard_multiClearNews_response", Namespace = "http://api.facebook.com/1.0/")]
        public class MultiClearNewsResponse
        {
            [XmlElement("dashboard_multiClearNews_response_elt")]
            public Elt[] Elements;

            public class Elt
            {
                [XmlAttribute("key")]
                public long Key;

                [XmlElement("dashboard_multiClearNews_response_elt_elt")]
                public KeyValuePair<long, bool>[] Elements;
            }
        }

        [XmlRoot("dashboard_removeActivity_response", Namespace = "http://api.facebook.com/1.0/")]
        public class RemoveActivityResponse
        {
            [XmlElement("dashboard_removeActivity_response_elt")]
            public KeyValuePair<long, bool>[] Elements;
        }

        public class KeyValuePair<K, V>
        {
            [XmlAttribute("key")]
            public K Key;

            [XmlText]
            public V Value;
        }
    }
}
